Lecture 9
2025-07-23
Continuous Random Variables
From discrete jumps to smooth curves: modeling the continuous world
By the end of this lecture, you will be able to:
python to work with continuous distributionsExamples: Dice rolls, number of emails, quiz scores
Examples: Height, weight, time, temperature
P(X = x) = 0 for Continuous Variables?For continuous random variables, the probability of any exact value is zero!
Think about it: What’s the probability someone is exactly 5.7324681… feet tall?
Instead, we ask:
P(5.7 ≤ X ≤ 5.8)?
P(X ≤ 6.0)?
P(X > 5.5)?
Key insight: We calculate probabilities for intervals, not exact points.
Click to see why P(X = exact value) = 0
🎯 Definition: The Probability Density Function (PDF) of a continuous random variable \(X\) is a function \(f(x)\) such that:
\[P(a \leq X \leq b) = \int_a^b f(x) \, dx\]
Properties of PDF:
Key Insight:
The area under the PDF curve between \(a\) and \(b\) gives the probability that \(X\) falls in that interval.
Probability = Area under curve: Select an interval to see probability
For continuous random variables, the CDF is:
\[F(x) = P(X \leq x) = \int_{-\infty}^x f(t) \, dt\]
Key relationship: \[f(x) = \frac{d}{dx}F(x)\]
The PDF is the derivative of the CDF!
Click anywhere to see F(x) = P(X ≤ x) for that point
Expected Value: \[E[X] = \mu = \int_{-\infty}^{\infty} x \cdot f(x) \, dx\]
Variance:
\[\text{Var}(X) = \sigma^2 = \int_{-\infty}^{\infty} (x - \mu)^2 f(x) \, dx = E[X^2] - (E[X])^2\]
Where:
\[E[X^2] = \int_{-\infty}^{\infty} x^2 \cdot f(x) \, dx\]
Important
Notice: Integrals replace sums when moving from discrete to continuous!
All values equally likely in an interval
Parameters: \(a\) (min), \(b\) (max)
PDF: \(f(x) = \frac{1}{b-a}\) for \(a \leq x \leq b\)
Mean: \(\frac{a+b}{2}\)
Variance: \(\frac{(b-a)^2}{12}\)
Use: Random numbers, waiting times
Bell-shaped, symmetric
Parameters: \(\mu\) (mean), \(\sigma^2\) (variance)
PDF: \(f(x) = \frac{1}{\sigma\sqrt{2\pi}} e^{-\frac{(x-\mu)^2}{2\sigma^2}}\)
Mean: \(\mu\)
Variance: \(\sigma^2\)
Use: Heights, test scores, errors
Models waiting times
Parameters: \(\lambda\) (rate)
PDF: \(f(x) = \lambda e^{-\lambda x}\) for \(x \geq 0\)
Mean: \(\frac{1}{\lambda}\)
Variance: \(\frac{1}{\lambda^2}\)
Use: Time between events, lifetimes
\[Z = \frac{X - \mu}{\sigma}\]
A bus arrives uniformly between 10:00 AM and 10:20 AM. Let \(X\) = arrival time in minutes after 10:00 AM.
(a) What is the PDF of \(X\)?
(b) What’s the probability the bus arrives between 10:05 and 10:12?
(c) What’s the expected arrival time?
Solution. (a) \(X \sim \text{Uniform}(0, 20)\) \[f(x) = \frac{1}{20-0} = \frac{1}{20} \text{ for } 0 \leq x \leq 20\]
(b) \(P(5 \leq X \leq 12) = \int_5^{12} \frac{1}{20} dx = \frac{1}{20} \times (12-5) = \frac{7}{20} = 0.35\)
(c) \(E[X] = \frac{a+b}{2} = \frac{0+20}{2} = 10\) minutes after 10:00 AM
Heights of adult women are normally distributed with μ = 64 inches and σ = 2.5 inches.
(a) What’s the probability a woman is taller than 67 inches?
(b) What height represents the 90th percentile?
(c) What’s the probability a woman is between 62 and 66 inches tall?
Solution. (a) \(P(X > 67) = P\left(Z > \frac{67-64}{2.5}\right) = P(Z > 1.2) = 1 - 0.8849 = 0.1151\)
(b) For 90th percentile: \(P(X \leq x) = 0.90\)
\(z_{0.90} = 1.28\), so \(x = 64 + 1.28(2.5) = 67.2\) inches
(c) \(P(62 \leq X \leq 66) = P\left(\frac{62-64}{2.5} \leq Z \leq \frac{66-64}{2.5}\right)\)
\(= P(-0.8 \leq Z \leq 0.8) = 0.7881 - 0.2119 = 0.5762\)
The time between customer arrivals at a store follows an exponential distribution with an average of 5 minutes between arrivals.
(a) What is the PDF?
(b) What’s the probability the next customer arrives within 3 minutes?
(c) What’s the probability no customer arrives in the next 10 minutes?
Solution. (a) Average = 5 minutes = \(\frac{1}{\lambda}\), so \(\lambda = 0.2\)
\[f(x) = 0.2e^{-0.2x} \text{ for } x \geq 0\]
(b) \(P(X \leq 3) = \int_0^3 0.2e^{-0.2x} dx = 1 - e^{-0.2 \times 3} = 1 - e^{-0.6} = 0.4512\)
(c) \(P(X > 10) = e^{-0.2 \times 10} = e^{-2} = 0.1353\)
CLT in Action: Run simulation to see the magic!
If \(Y = aX + b\), then:
\[Z = \frac{X - \mu}{\sigma} \sim N(0, 1)\]
Important: Normal distributions are closed under linear transformations!
| Property | Discrete | Continuous |
|---|---|---|
| Probability Function | PMF: \(P(X = x)\) | PDF: \(f(x)\) |
| Exact Value Probability | \(P(X = x) > 0\) possible | \(P(X = x) = 0\) always |
| Interval Probability | \(\sum P(X = x_i)\) | \(\int_a^b f(x) dx\) |
| Expected Value | \(\sum x \cdot P(X = x)\) | \(\int x \cdot f(x) dx\) |
| Variance | \(\sum (x-\mu)^2 P(X = x)\) | \(\int (x-\mu)^2 f(x) dx\) |
| CDF | \(\sum_{x_i \leq x} P(X = x_i)\) | \(\int_{-\infty}^x f(t) dt\) |
Memoryless Property (Exponential only):
\(P(X > s+t | X > s) = P(X > t)\)
Symmetry (Normal):
\(P(X \leq \mu - a) = P(X \geq \mu + a)\)
Scaling Invariance (Normal):
Linear combinations of normals are normal
Remember: Area under PDF = 1, but PDF values can exceed 1!
Choose distributions based on the data characteristics:
Topics we’ll cover:
Connection: Continuous distributions (especially normal) form the foundation for statistical inference
Office Hours: 11AM on Thursday (link on Canvas)
Email: nmathlouthi@ucsb.edu
Next Class: Statistical Inference and Hypothesis Testing
Understanding Data – Continuous Random Variables © 2025 Narjes Mathlouthi